package civaid.datamodel;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Logger;

import javax.jdo.annotations.IdGeneratorStrategy;
import com.google.appengine.api.datastore.Key;

import javax.jdo.annotations.Element;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

@PersistenceCapable
public class Civilization {

	private static transient Logger log = Logger.getLogger(Civilization.class.getName());

	public static enum CIVILIZATION_ID {
		africa, iberia, italy, illyria, thrace, crete, asia, assyria, babylon, egypt
	};

	public static enum CARD_ID {
		c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23
	};

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key key;

	@Persistent(mappedBy = "civilization")
	private Collection<CivilizationEvent> civilizationEvents;

	@Persistent
	private String civilizationId;

	@Persistent
	@Element(dependent = "true")
	private Session session;

	
	@Persistent
	private String player;

	@Persistent
	private int tradeGoodsPoints = 0;
	
	@Persistent
	private int treasuryPoints = 0;

	@Persistent
	private int citiesPoints = 0;
	
	@Persistent
	private int astValuePoints = 0;

	
	public Civilization(CIVILIZATION_ID civilizationId) {
		this.civilizationId = civilizationId.toString();
	}

	public Key getKey() {
		return key;
	}
	
	
	public CIVILIZATION_ID getCivilizationId() {
		return CIVILIZATION_ID.valueOf(civilizationId);
	}

	public String getPlayer() {
		return player;
	}

	public void setPlayer(String player) {
		this.player = player;
	}

	public Session getSession() {
		return session;
	}

	public void setSession(Session session) {
		this.session = session;
	}

	public Collection<CivilizationEvent> getCivilizationEvents() {
		return civilizationEvents;
	}

	public int getTradeGoodsPoints() {
		return tradeGoodsPoints;
	}

	public void setTradeGoodsPoints(int tradeGoodsPoints) {
		this.tradeGoodsPoints = tradeGoodsPoints;
	}

	public int getTreasuryPoints() {
		return treasuryPoints;
	}

	public void setTreasuryPoints(int treasuryPoints) {
		this.treasuryPoints = treasuryPoints;
	}

	public int getCitiesPoints() {
		return citiesPoints;
	}

	public void setCitiesPoints(int citiesPoints) {
		this.citiesPoints = citiesPoints;
	}

	public int getAstValuePoints() {
		return astValuePoints;
	}

	public void setAstValuePoints(int astValuePoints) {
		this.astValuePoints = astValuePoints;
	}	

}
